/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("tb_project_workflowstep",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using MYData.Entity.DomainModels;
using MYData.System.IServices;
using MYData.Entity.DomainModels.ApiEntity.Input;
using Microsoft.AspNetCore.Authorization;
using MYData.Core.Utilities;
using Microsoft.EntityFrameworkCore.Metadata.Internal;

namespace MYData.System.Controllers
{
    public partial class tb_project_workflowstepController
    {
        private readonly Itb_project_workflowstepService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public tb_project_workflowstepController(
            Itb_project_workflowstepService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }
        /// <summary>
        /// 结点审核添加
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost, Route("WorkFlowStepAddTs")]
        public IActionResult WorkFlowStepAddTs([FromBody] WorkStepInput_Dto inputDto)
        {
            return Json(_service.WorkFlowStepAddTs(inputDto));
        }
        /// <summary>
        /// 根据项目ID查询流程节点
        /// </summary>
        /// <param name="projectId"></param>
        /// <returns></returns>
        [HttpGet, Route("GetWorkFlowStep")]
        public IActionResult GetWorkFlowStep(string projectId)
        {
            return Json(_service.GetWorkFlowStep(projectId));
        }
        [HttpGet, Route("GetWorkStepInfo")]
        public IActionResult GetWorkStepInfo(string projectId)
        {
            return Json(_service.GetWorkStepInfo(projectId));
        }
        /// <summary>
        /// 获取判断条件的集合
        /// </summary>
        /// <param name="tableName"></param>
        /// <returns></returns>
        [HttpGet, Route("JudgmentConditions")]
        public IActionResult JudgmentConditions(string? tableName="")
        {
            return Json(_service.JudgmentConditions(tableName));
        }

        /// <summary>
        ///  新增入账单节点审核添加
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost, Route("newAccountAdd")]
        public IActionResult newAccountAdd([FromBody] NewAccountInput_Dto inputDto)
        {
            return Json(_service.newAccountAdd(inputDto));
        }
        /// <summary>
        ///  经费分配节点审核添加
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost, Route("newAllotAdd")]
        public IActionResult newAllotAdd([FromBody] NewAllotInput_Dto inputDto)
        {
            return Json(_service.newAllotAdd(inputDto));
        }
        /// <summary>
        /// 获取退回操作
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="stepId"></param>
        /// <returns></returns>
        [HttpGet, Route("GetReturnWorkFlowStep")]
        public IActionResult GetReturnWorkFlowStep(string projectId, string stepId)
        {
            return Json(_service.GetReturnWorkFlowStep(projectId,stepId));
        }
    }
}
